#include "SkillShadowStrike.h"
#include "Character/SkillPart.h"
#include "base/core/log.h"

SkillShadowStrike::SkillShadowStrike()
{

}
SkillShadowStrike:: ~SkillShadowStrike()
{

}

void SkillShadowStrike::OnDamageTimedo(uint32_t skillId)
{
	cList lsTageter;
	stSkillInfo *pSkill = m_pPart->GetSkillInfo(skillId);
	MMOLOG_PROCESS_ERROR(pSkill);

	m_pPart->KillTimedo(m_nGlobelID);
	MMOLOG_PROCESS_ERROR(m_curDamageCount < (uint32_t)m_vTargetCids.size());

	//计算技能结果
	lsTageter.push_back(m_vTargetCids[m_curDamageCount]);
	m_pPart->SkillResult(pSkill->_Id, pSkill->_pSkillmeta, m_curDamageCount, m_focoTime, lsTageter);

	if (pSkill->_pSkillmeta->damageTime.size() > m_curDamageCount + 1)
	{
		m_curDamageCount++;
		m_pPart->SetTimedo(m_nGlobelID, pSkill->_pSkillmeta->damageTime[m_curDamageCount], 1);
	}
	else
	{
		//技能一次释放完成，需要删通知删除
		m_pPart->RemoveSkillFightInfo(m_nGlobelID);
	}
	return;
Exit0:
	m_pPart->KillTimedo(m_nGlobelID);
	m_pPart->RemoveSkillFightInfo(m_nGlobelID);
}

void SkillShadowStrike::OnDamageTimedoPlayer(uint32_t skillId, cList & vtargetList)
{
	stSkillInfo *pSkill = m_pPart->GetSkillInfo(skillId);
	MMOLOG_PROCESS_ERROR(pSkill);

	m_pPart->KillTimedo(m_nGlobelID);

	m_pPart->SkillResult(pSkill->_Id, pSkill->_pSkillmeta, m_curDamageCount, m_focoTime, vtargetList);


	if (pSkill->_pSkillmeta->damageTime.size() > m_curDamageCount + 1)
	{
		m_curDamageCount++;
	}
	else
	{
		//技能一次释放完成，需要删通知删除
		m_pPart->RemoveSkillFightInfo(m_nGlobelID);
	}
	return;
Exit0:
	m_pPart->KillTimedo(m_nGlobelID);
	m_pPart->RemoveSkillFightInfo(m_nGlobelID);
}